/**
 *   FUSE-J: Java bindings for FUSE (Filesystem in Userspace by Miklos Szeredi (mszeredi@inf.bme.hu))
 *
 *   Copyright (C) 2003 Peter Levart (peter@select-tech.si)
 *
 *   This program can be distributed under the terms of the GNU LGPL.
 *   See the file COPYING.LIB
 */

package fuse;

import java.nio.ByteBuffer;


/**
 * This is a byte level filesystem API (in contrast to String level filesystem API like fuse.Filesystem).
 * Any paths/names are passed as native ByteBuffer objects or byte[] arrays. This is the interface
 * that is called from JNI bindings. It is not intended that this interface be implemented directly by users
 * but instead a fuse.Filesystem interface should be implemented and encoding of file names and paths should
 * be left to a special adapter class: fuse.FilesystemToFuseFSAdapter.
 */
public interface FuseFS extends FilesystemConstants
{
   public FuseStat getattr(ByteBuffer path) throws FuseException;

   public void readlink(ByteBuffer path, ByteBuffer link) throws FuseException;

   public FuseFSDirEnt[] getdir(ByteBuffer path) throws FuseException;

   public void mknod(ByteBuffer path, int mode, int rdev) throws FuseException;

   public void mkdir(ByteBuffer path, int mode) throws FuseException;

   public void unlink(ByteBuffer path) throws FuseException;

   public void rmdir(ByteBuffer path) throws FuseException;

   public void symlink(ByteBuffer from, ByteBuffer to) throws FuseException;

   public void rename(ByteBuffer from, ByteBuffer to) throws FuseException;

   public void link(ByteBuffer from, ByteBuffer to) throws FuseException;

   public void chmod(ByteBuffer path, int mode) throws FuseException;

   public void chown(ByteBuffer path, int uid, int gid) throws FuseException;

   public void truncate(ByteBuffer path, long size) throws FuseException;

   public void utime(ByteBuffer path, int atime, int mtime) throws FuseException;

   public FuseStatfs statfs() throws FuseException;

   public long open(ByteBuffer path, int flags) throws FuseException;

   public void read(ByteBuffer path, long fh, ByteBuffer buf, long offset) throws FuseException;

   public void write(ByteBuffer path, long fh, boolean isWritepage, ByteBuffer buf, long offset) throws FuseException;

   public void flush(ByteBuffer path, long fh) throws FuseException;

   public void release(ByteBuffer path, long fh, int flags) throws FuseException;

   public void fsync(ByteBuffer path, long fh, boolean isDatasync) throws FuseException;
}
